<?php session_start();
require '../config.php';
require '../permisos.php';
setPermisos(700);
if (empty($_SESSION['nombre']))
	echo "<meta http-equiv='Refresh' content='0;url=../index.php'>";
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Seguimiento de Ordenes</title>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
   	<link href="../bootstrap/css/view.css" rel="stylesheet">
   	<link href="../bootstrap/css/cupertino/jquery.ui.all.css" rel="stylesheet" type="text/css">
 	<script type="text/javascript" src="../bootstrap/scripts/view.js"></script>
    <script type="text/javascript" src="../bootstrap/scripts/jquery.js"></script> 
	<script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script> 
	<script type="text/javascript" src="../bootstrap/js/jquery.ui.core.min.js"></script>
	<script type="text/javascript" src="../bootstrap/js/jquery.ui.datepicker.min.js"></script>
	
	<script type="text/javascript" src="../bootstrap/js/toastr.min.js"></script>
	<link href="../bootstrap/css/toastr.min.css" rel="stylesheet">    
		
   
   	
  </head>
<body >
<div id="a_header">
		<div class="container">
			<div class="row">
				<div class="span10">
					
					<img src="../imagenes/CRM HV alta.png" width="175" height="110"  style="float:left;" alt="" />					</a>
					<div style="display:inline-block; margin-top:20px;">
						<h3 style="margin:0px;">Sistema de Administraci&oacute;n y Gesti&oacute;n de Clientes (CRM)</h3>
					</div>
				</div>
					<div class="btn-group pull-right upan">
						  <button type="button" class="btn btn-primary" id ="drop"><span class= "glyphicon glyphicon-user"><?php if (! empty($_SESSION['nombre'])) echo("   ". $_SESSION['user']);?></span></button>
						  <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" id="drop2">
						    <span class="caret"></span>
						  </button>
						  
						  <ul class="dropdown-menu" role="menu">
						  
						    <li><a href="../TableroInicio.php" title="Tablero Principal">Inicio</a></li>
						     <li class="divider"></li>
						    <li><a href="../cerrar_sesion.php" title="Cerrar sesi&oacute;n">Salir</a></li>
						  </ul>
					</div>
			</div>
		</div>
 	</div> 
<div style="background-color:#0455A7; height:3px;"></div>	<!--  fin header -->

<div class="container" style= "width: 100%">
				<br>
				
				<br>
				<legend>Seguimiento de Ordenes de Trabajo</legend>
				<div class="btn-group" data-toggle="buttons">
				<?php if($abrir) { ?>
				<label class="btn btn-success">
				    <input type="radio" name="options" id="option4" onchange="reportar(1);">- Recibidas -
				  </label>
				
				<label class="btn btn-success">
				    <input type="radio" name="options" id="option3" onchange="reportar(2);">- En Proceso -
				  </label>
				  <label class="btn btn-success">
				    <input type="radio" name="options" id="option2" onchange="reportar(3);">- Archivadas -
				  </label>
				 <label class="btn btn-success">
				    <input type="radio" name="options" id="option1" onchange="reportar(4);">- Mis Asignaciones -
				  </label>
				  <!-- <label class="btn btn-success">
				    <input type="radio" name="options" id="option0" onchange="reportar(5);">- ... -
				  </label> -->
				   <?php  } ?>
				</div>
	<div id="busqueda" style="display: block;">
		<h4>B&uacute;squeda y Seguimiento de Ordenes de Trabajo.</h4>
		<nav class="navbar navbar-default" role="search" style="width:100%;">
		<form class="navbar-form navbar-left" role="search" method="post" action="" onsubmit="traerTabla(); return false" >
  			<div class="form-group">
    			<input type="search" class="form-control" size="60" id = "textofiltro" placeholder="Nombre del Cliente...">
  			</div>
  			<button type="button" class="btn btn-default" onclick="buscarCliente();" id="buscar">Buscar <img src="../imagenes/glyphicons_027_search.png" width="15" height="15" />  </button>
	        <button type="button" class="btn btn-danger" onclick="window.location='../TableroInicio.php';"><img src="../imagenes/glyphicons_380_message_forward.png" width="17" height="15" /> Inicio</button>
		</form>
			 
		</nav>
	</div>
	
	
	
</div>
	<div class="container" style="min-height:200px;">
		
		<div id="tabla">
		</div>
	
	</div>
	<!-- Modal 
					  <div class="modal fade" id="modalmode" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					    <div class="modal-dialog">
					      <div class="modal-content">
					        <div class="modal-header">
					          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					          <h4 class="modal-title">Actualizaci&oacute;n de Datos</h4>
					        </div>
					        <div class="modal-body" style="text-align: left; background-color:#f2f9f2">
						   		<div id="datos">
						   		<legend>Observaci&oacute;n:</legend>
						   			<textarea id="req" rows="10" cols="50" class="element text"></textarea>
								</div>																		
						     </div>
					        <div class="modal-footer">
					         <button type="button" class="btn btn-primary" onclick="actualizarDatos(); return false">Actualizar</button>
					          <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
					      
					        </div>
					      </div><!-- /.modal-content -->
<!--					    </div><!-- /.modal-dialog -->
<!--					  </div><!-- /.modal -->
<!--  footer -->
   
    <footer style="margin-top: 20px; background-color:#FFF;">
		<div style="background-color:#00f; height:5px;"></div>
        <div class="container" style="height:100px;">
			<div class="row">
				<div class="span2" style="float:right;">
					<p style="">Desarrollado por:</p>
					<a href="http://www.3tech-panama.com"><img src="../imagenes/3techpaylogo.png"alt="3tech panama" style="width:134px; height:50px; float:right;" /></a>
			   </div>
			</div>
		</div>
        <div style="background-color:#0000FF; height:25px;">
            <div class="container" >
                <p style="margin-left: 10px; color:#FFF;">Copyright &copy; 2013 HOSANNA. Todos los derechos reservados. </p>
            </div>
        </div>	
    </footer>
</body>
<script type="text/javascript">

function crearXMLHttpRequest() 
{
  var xmlHttp=null;
  if (window.ActiveXObject) 
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else 
    if (window.XMLHttpRequest) 
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}

var conexhttp;

function historia(idot)
{
	try {
		
		conexhttp=crearXMLHttpRequest();
		conexhttp.onreadystatechange = presentarReporte;
		conexhttp.open('GET',"getHistorialOrdenes.php?idorden="+idot, true);
		conexhttp.send(null);
	} catch (err) {
		alert("Error JS= " + err.message);
	}
}
function reportar(opcion)
{
	try {
		//$('#buscar').toggle('slow');
		conexhttp=crearXMLHttpRequest();
		conexhttp.onreadystatechange = presentarReporte;
		conexhttp.open('GET',"getReporteOrdenes.php?opcion="+opcion, true);
		conexhttp.send(null);
	} catch (err) {
		alert("Error JS= " + err.message);
	}
}
function presentarReporte()
{
	
	
  if(conexhttp.readyState == 4)
  {
	   document.getElementById('tabla').innerHTML = conexhttp.responseText;
  }
  else document.getElementById('tabla').innerHTML = "<strong>Por favor espere...</strong><br>"+retornarBarra();
	  
	 
}
function abrir(codigoOrden)
{
	window.location.href="recibirorden.php?Orden="+codigoOrden;
	//$("#tabla").load('recibirorden.php?Orden='+codigoOrden);
}
function retornarBarra()
{
	
	$taghtml = "<div class='progress progress-striped active'><div class='progress-bar'  role='progressbar' aria-valuenow='40' aria-valuemin='25' aria-valuemax='50' style='width: 100%'></div>";
	return $taghtml;	
}
function prueba()
{
	
	$("#modalmode").modal("show");
}
function buscarCliente()
{
	var filtro=$('#textofiltro').val();
	if(filtro=="")return;
	try {
		
		conexhttp=crearXMLHttpRequest();
		conexhttp.onreadystatechange = presentarReporte;
		conexhttp.open('GET',"getReporteOrdenes.php?opcion=5&filtro="+filtro, true);
		conexhttp.send(null);
	} catch (err) {
		alert("Error JS= " + err.message);
	}

}
</script>

</html>